package com.ch.playandroid.fragment

import android.content.Context
import android.util.Log
import android.view.TextureView
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.ch.common.base.fragment.BaseFragment
import com.ch.playandroid.R
import com.ch.playandroid.adapter.ImageViewViewHolder
import com.ch.playandroid.adapter.ViewPager2ViewHolder
import com.ch.playandroid.databinding.FragmentNewsBinding
import com.ch.playandroid.viewmodel.NewsViewModel
import kotlinx.android.synthetic.main.fragment_my.view.*

class NewsFragment : BaseFragment<NewsViewModel, FragmentNewsBinding>() {

    override fun getLayoutResID(): Int {
        return R.layout.fragment_news
    }

    override fun initView() {
//        mBinding.viewPager2.orientation = ViewPager2.ORIENTATION_VERTICAL
//
//        val adapter = ViewPagerAdapter()
//        mBinding.viewPager2.adapter = adapter

    }

    override fun initObserve() {
    }

    override val viewModel: NewsViewModel by viewModels()
    override fun bindViewModel() {
    }
}

class ViewPagerAdapter() :
    RecyclerView.Adapter<ViewPager2ViewHolder>() {
    val list = listOf<String>("chenhu", "hogan", "cpr")

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewPager2ViewHolder {
        val mTextView = TextView(parent.context)
        mTextView.textSize = 80f
        return ViewPager2ViewHolder(mTextView)
    }


    override fun getItemCount(): Int {

        return list.size
    }


    override fun onBindViewHolder(holder: ViewPager2ViewHolder, position: Int) {
       // val ss = holder.itemView as TextView

      //  ss.text = list[position]

    }

}